<?php
session_start();
require_once("dbconnect.php");
//ob_start();

$exname=$_GET['searchField'];
//echo $exname;
$sql="select * from executives where exe_name='$exname';";
//echo $sql;
$result=mysql_query($sql) or die(mysql_error());
while($r=mysql_fetch_assoc($result))
	{
	$id=$r['id'];
	
	}
$frmDate=dateconvert($_GET['frmDate'],1);
//echo $frmDate;
$toDate=dateconvert($_GET['toDate'],1);
$qry="select * from daily_activity where exe_id='$id' and edate between '$frmDate' and '$toDate' order by edate ;";
//echo $qry;
$res=mysql_query($qry) or die(mysql_error());

function dateconvert($date,$func) 
{	
if ($func == 1)
{ //insert conversion
list($day, $month, $year) = split('[/.-]', $date);
$date = "$year-$month-$day";
return $date;
}
}
function dateconvrt($date,$func) 
{	
if ($func == 1)
{ //insert conversion
list($year, $month, $day) = split('[/.-]', $date);
$date = "$day-$month-$year";
return $date;
}
}
 ?>
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		$('#infoTable').dataTable();
	} );
</script>

<table width="870" border="0" align="center" cellspacing="0" cellpadding="0">
       <tr>
            <td align="left" valign="top">
           <table width="895" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td>
               <div id="demo">
                <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#F7A886" class="tablebox" id="infoTable">
                <thead>
                  <tr background="images/hed-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
                    
                    <th width="18" height="40" align="center" valign="middle" class="hed"><strong>Sr. No </strong></th>
                    <th colspan="2" align="center" valign="middle" class="hed"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td colspan="2" align="center"><strong>Time </strong></td>
                        </tr>
                        <tr>
                          <td height="1" align="center" valign="top" bgcolor="#F7A886"></td>
                          <td height="1" align="center" valign="top" bgcolor="#F7A886"></td>
                        </tr>
                        <tr>
                          <td width="48%" align="center" valign="top">In</td>
                          <td width="52%" align="center" valign="top">Out</td>
                        </tr>
                    </table></th>
                    <th width="70" align="center" valign="middle" class="hed"><strong>Organisation</strong></th>
                    <th width="64" align="center" valign="middle" class="hed"><strong>Industry Type </strong></th>
                    <th width="62" align="center" valign="middle" class="hed"><strong>E/L/P</strong></th>
                    <th width="80" align="center" valign="middle" class="hed"><strong>Contact Person </strong></th>
                    <th width="84" align="center" valign="middle" class="hed"><strong>Designation</strong></th>
                    <th width="72" align="center" valign="middle" class="hed"><strong>Telephone Number </strong></th>
                    <th colspan="2" align="center" valign="middle" class="hed"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td colspan="2" align="center"><strong>Visit </strong></td>
                        </tr>
                        <tr>
                          <td height="1" align="center" valign="top" bgcolor="#F7A886"></td>
                          <td height="1" align="center" valign="top" bgcolor="#F7A886"></td>
                        </tr>
                        <tr>
                          <td width="48%" align="center" valign="top">Obj</td>
                          <td width="52%" align="center" valign="top">o/c</td>
                        </tr>
                    </table></th>
                    <th width="40" align="center" valign="middle" class="hed"><strong>Next Steps </strong></th>
                    <th width="65" align="center" valign="middle" class="hed"><strong>Kms..</strong></th>
                    <th width="55" align="center" valign="middle" class="hed"><strong>Remarks</strong></th>
                    <th width="55" align="center" valign="middle" class="hed"><strong>Date</strong></th>
                  </tr>
                  </thead>
                  <tbody>
                   <?php 
				 $i=1;
				while($row=mysql_fetch_assoc($res))
					{
						$timein=$row['timein'];
						$timeout=$row['timeout'];
						$org=$row['organisation'];
						$indstype=$row['industry_type'];
						$elp=$row['elp'];
						$contperson=$row['cont_person'];
						$desgn=$row['disgnation'];
						$tele=$row['telephone'];
						$visitobj=$row['visit_objective'];
						$visitout=$row['visit_outcome'];
						$nextstep=$row['nextstep'];
						$kms=$row['kms'];
						$remarks=$row['remarks'];
						$edate=dateconvrt($row['edate'],1);
	
					
				?>
                  <tr>
                   
                    <td bgcolor="#FEF5E7"><?php echo $i;?></td>
                    <td width="20" bgcolor="#FEF5E7"><?php echo $timein;?></td>
                    <td width="20" bgcolor="#FEF5E7"><?php echo $timeout;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $org;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $indstype;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $elp;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $contperson;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $desgn;?></td>
                    <td bgcolor="#FEF5E7"><?php echo $tele;?></td>
                    <td width="40" bgcolor="#FEF5E7"><?php echo $visitobj;?></td>
                    <td width="40" bgcolor="#FEF5E7"><?php echo $visitout;?></td>
                    <td align="center" bgcolor="#FEF5E7"><img src="images/arrow-li.gif" name="pop<?php echo $i;?>" width="26" height="22" border="0" align="absmiddle" class="popup" id="pop<?php echo $i;?>"/>
                    <div id="bulletinDialogpop<?php echo $i;?>" style="display: none;" title="Nextstep">
                    <textarea id="editor"  name="Message" rows="10" ><?php echo $nextstep?></textarea> 
                    <!--<input class="button-right" type="button" id="ok" value="ok" id="pop"/>-->
                     </div>
                    <!--<input type="hidden" name="nst[]" id="nstpop<?php /*?><?php echo $i;?><?php */?>" value="<?php /*?><?php echo $nextstep;?><?php */?>"/>--></td>
                    <td bgcolor="#FEF5E7"><?php echo $kms;?></td>
                    <td align="center" bgcolor="#FEF5E7"><img src="images/arrow-li.gif" width="26" height="22" border="0" align="absmiddle"  name="tarea1" id="repop<?php echo $i;?>" class="popup2"/>
                    <div id="remarksDialogrepop<?php echo $i;?>" style="display: none;" title="Remarks">
                    <textarea id="remarksEditor"  name="Message" rows="10" ><?php echo $remarks;?></textarea>
                    <!-- <input class="button-right" type="button" id="save" value="OK" />-->
                     </div>
                      <br />
                      <!--<input type="hidden" name="rem[]" id="remrepop<?php /*?><?php echo $i;?><?php */?>" value="<?php /*?><?php echo $remarks;?><?php */?>"/>--></td>
                    <td align="center" bgcolor="#FEF5E7"><?php echo $edate;?></td>
                  </tr>
                  <?php 
				  $i++;
				}
				?>
                </tbody>
                </table>       
                </div>
                  </td>
              </tr>
              <tr>
                <td height="10" align="left" valign="top"></td>
              </tr>
              <tr>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="895" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="528" align="left" valign="top"><table width="500" border="0" align="left" cellpadding="5" cellspacing="1" bgcolor="#FCE0B6">
                        <tr>
                          <td height="40" colspan="2" bgcolor="#FFECCC" class="hed-blc">Day Activity </td>
                          <td colspan="2" bgcolor="#FFECCC" class="hed-blc">Sales Performance</td>
                        </tr>
                        <tr>
                          <td width="199" bgcolor="#FEF5E7" class="content">Organization Visited &nbsp;&nbsp;&nbsp;&nbsp;</td>
                          <td width="26" bgcolor="#FEF5E7" class="content"><input name="count" id="count" type="text"  size="3" readonly /></td>
                          <td width="206" bgcolor="#FEF5E7" class="content">Target for the Month </td>
                          <td width="24" bgcolor="#FEF5E7" class="content"><input name="target[]" id="target[]" type="text"  size="3" /></td>
                        </tr>
                        <tr>
                          <td bgcolor="#FEF5E7" class="content">contacts met: </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="contacts[]" id="contacts[]" type="text"  size="3" /></td>
                          <td bgcolor="#FEF5E7" class="content">Todays actuals </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="todays[]" id="todays[]" type="text"  size="3" /></td>
                        </tr>
                        <tr>
                          <td height="21" bgcolor="#FEF5E7" class="content">Distance Travelled</td>
                          <td bgcolor="#FEF5E7" class="content"><input name="distance[]" id="distance[]" type="text"  size="3" /></td>
                          <td bgcolor="#FEF5E7" class="content">MTD actuals </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="mtd[]" id="mtd[]" type="text"  size="3" /></td>
                        </tr>
                        <tr>
                          <td bgcolor="#FEF5E7" class="content">Local Conveyance(Rs): </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="locacon[]" id="localcon" type="text"  size="3" /></td>
                          <td bgcolor="#FEF5E7" class="content">% achievement against month target </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="achieve[]" id="achieve" type="text"  size="3" /></td>
                        </tr>
                        <tr>
                          <td bgcolor="#FEF5E7" class="content">Travel stay related expenses(RS) </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="tstay[]" id="tstay[]" type="text"  size="3" /></td>
                          <td bgcolor="#FEF5E7" class="content">Balance to achieve </td>
                          <td bgcolor="#FEF5E7" class="content"><input name="bachieve[]" id="bachieve" type="text"  size="3" /></td>
                        </tr>
                    </table></td>
                    <td width="367" align="left" valign="top"><table width="367" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><strong class="content">If in the office, assaignments done today: </strong></td>
                        </tr>
                        <tr>
                          <td height="8"></td>
                        </tr>
                        <tr>
                          <td><textarea name="textarea" class="input1"></textarea>                          </td>
                        </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="5"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>                       </td>
  </tr>
         
          <tr>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</td>
          </tr>
          
          <tr>
            <td align="left" valign="top"><table width="655" border="0" align="left" cellpadding="0" cellspacing="0">
              <tr>
                <td width="655" height="35" background="images/box-topbg1.jpg" style="background-repeat:no-repeat; background-position:center top"><table width="600" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="236"><span class="hed-blc"></span><span class="hed-color"> Visit Objectives (Specific) </span></td>
                    <td width="364"><span class="hed-color">Visit Outcomes (Suggestive) </span></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td background="images/box-mid1.jpg" style="background-repeat:repeat-y; background-position:center top"><table width="654" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top" class="content"><ol>
                      <li>introduction</li>
                      <li>Enquiry Generation</li>
                      <li>Lapsed Revival</li>
                      <li>Customer Mapping</li>
                      <li>Resolving Technical Query </li>
                      <li>Tender Quotation Submission</li>
                      <li>Customer Presentation</li>
                      <li>Order Finalisation</li>
                      <li>Handle Rejaction</li>
                      <li>Sales Training(RSM/BM) </li>
                      <li>Cold call </li>
                      <li>Payment/sales tax from</li>
                      <li>collactec</li>
                    </ol></td>
                    <td align="left" valign="top" class="content"><ol>
                      <li>Introduction of RS products/services in the company</li>
                      <li>Recaipl of enquiry(s)</li>
                      <li>potential mapping@building databases</li>
                      <li>Identified requirements</li>
                      <li>techno-commercial offer to be submitted </li>
                      <li>Offer submitted and negotiated</li>
                      <li>Order expected within...(date) </li>
                      <li>Techbical query(details) resolved/alternative proposed</li>
                      <li>presentation Successfully done to ..(nos) of new</li>
                      <li>depit/people </li>
                      <li>New contacts to be visited in next visit </li>
                      <li>Order finalised, Value(Rs.)</li>
                      <li>Discussed and resolved materieal rejection issue(details to</li>
                      <li>be mentioned)</li>
                      <li>Accompanied TSE/BM on sales call(key observation to be reported) </li>
                      <li>Any Other(to specify)</li>
                    </ol></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td><img src="images/box-topbo1.jpg" width="600" height="14" /></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
        </table>